UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sg5p1dfk8AJZ5C2qVoIXtPWcptXn61ZJnHb+dpKibqg=' 
WHERE 
  key_id = 'f3189f2c8d34c2ab61666ad554574bf223e2ca7e7ccf0a31def0b28df691061c' 
  AND (
    token = 'sg5p1dfk8AJZ5C2qVoIXtPWcptXn61ZJnHb+dpKibqg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065