UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G1ROnW3RGPARPTFocpaRwPW1jHjp7Ctu1aeINvmV+LA=' 
WHERE 
  key_id = '112139ad9f96ac0d5bf1f9cc5b96e9143626a7025a421550b228f492089aaccb' 
  AND (
    token = 'G1ROnW3RGPARPTFocpaRwPW1jHjp7Ctu1aeINvmV+LA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032