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

Query time 0.00033