UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pWNtdOWT7v3sxGpDkNRLNfdbyiOuK3RYc8ylsJoKNfE=' 
WHERE 
  key_id = '7806576154f9481b165eea6ba403cc99e9669c577c19788c22cde91b0fdb8202' 
  AND (
    token = 'pWNtdOWT7v3sxGpDkNRLNfdbyiOuK3RYc8ylsJoKNfE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044