UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wKmFiN8/AUMQCBWJ1irRlKpS1Yo257goY03is71ZALQ=' 
WHERE 
  key_id = '772616619b8e803e83ab2f7d1f5e828160b16f333b2f9ff8e667195474c6fc40' 
  AND (
    token = 'wKmFiN8/AUMQCBWJ1irRlKpS1Yo257goY03is71ZALQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025