UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DNz00Khs8eG5m7YXfYlO7A00wfsZtpzt8Zw0tKgvwPw=' 
WHERE 
  key_id = '499607e82f758ebfb0c6bedf339a7993de74b545004a7f50e726e927373fc93f' 
  AND (
    token = 'DNz00Khs8eG5m7YXfYlO7A00wfsZtpzt8Zw0tKgvwPw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050