UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c45qMvBBFGQpqgMGLvbXhScvg/zot28f8KiCdNuAw9c=' 
WHERE 
  key_id = '01c19300515fda58399fbab4dd3674114b40959256576f39129d34b3101c3582' 
  AND (
    token = 'c45qMvBBFGQpqgMGLvbXhScvg/zot28f8KiCdNuAw9c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035