UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tHTAPpH0x1X3GMQwePWXp1lCGsqARS/OqCefCpSCS98=' 
WHERE 
  key_id = '0743b495977022b6081c14ff5e45037e41514a32780df24ab363572990f16bad' 
  AND (
    token = 'tHTAPpH0x1X3GMQwePWXp1lCGsqARS/OqCefCpSCS98=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029