UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W/z47YZl2+DkJYoCRHQXScw6EBd1Na2aTJEMsFIS3dQ=' 
WHERE 
  key_id = '9f2bd165d87d578ecb1a88ff597d43138b881814063c73cea0e35a7b923fec37' 
  AND (
    token = 'W/z47YZl2+DkJYoCRHQXScw6EBd1Na2aTJEMsFIS3dQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034