UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OWybEsNERTkkG0VZU4TdjwByvRrFOk5/XhhPQ392HCI=' 
WHERE 
  key_id = 'b485cdcfc7d00e404c58a161652084fd316ea4a60022abca3cedc986d69abd18' 
  AND (
    token = 'OWybEsNERTkkG0VZU4TdjwByvRrFOk5/XhhPQ392HCI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026