UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BUjjl3p+0pKey30lNVKkAhJYOrlCEFdMhAhXRY2CnxE=' 
WHERE 
  key_id = 'deab8840d897d41e26ac0e58f9d02a118da251e9121253ae79465215a47bf0d8' 
  AND (
    token = 'BUjjl3p+0pKey30lNVKkAhJYOrlCEFdMhAhXRY2CnxE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043