UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LvI/ru6TQM3A6VEyOwoZjp9vYqc80ReRxWxkiuGDMlc=' 
WHERE 
  key_id = '836f5a9d9c1d2a7df0e49f81cb027bddbf42f931343a7ea138051ce676442a5e' 
  AND (
    token = 'LvI/ru6TQM3A6VEyOwoZjp9vYqc80ReRxWxkiuGDMlc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022