UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P1vKyUxtnmzJObkNlun41U4ivChWE/5BO8FLkKHKNko=' 
WHERE 
  key_id = '6ed2c067464a25748e90e7d2a19d02c10d4a4d5d3584ebc4aea307669f1db0d5' 
  AND (
    token = 'P1vKyUxtnmzJObkNlun41U4ivChWE/5BO8FLkKHKNko=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058