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

Query time 0.00028