UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gqzcxOFumuinhOsK8XMLSWoO/Gy9cH8ZmleT+9kvzvo=' 
WHERE 
  key_id = 'af39a7cb83c0a44c4091d407db5ec9e906803c6b47c5d78ad74b14b089a70705' 
  AND (
    token = 'gqzcxOFumuinhOsK8XMLSWoO/Gy9cH8ZmleT+9kvzvo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00081