UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T6xVBg48Oh7RHJBet7nNaeuApuSI+vfLxYR49SyxOwM=' 
WHERE 
  key_id = 'afd138f98e0f37b4f4ac91a0147cf5bfd50f08bfc542b298d603e191389b0390' 
  AND (
    token = 'T6xVBg48Oh7RHJBet7nNaeuApuSI+vfLxYR49SyxOwM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036