UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vrwNWU77D0swL37cSwUzsqduKfFJip8zR9tAglLnPZ0=' 
WHERE 
  key_id = 'da64cebcddce5de5daa3c69958c5319353affe46636054d85bd3db97915ac28d' 
  AND (
    token = 'vrwNWU77D0swL37cSwUzsqduKfFJip8zR9tAglLnPZ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028