UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'huT/spV7Y7Hetc6Xsh9q3x7imOkNABBMFBlHJiK3r4Q=' 
WHERE 
  key_id = '50b1e085abf593b003344e779cc7d6068afb3f7d9fd691300a5a7b9a182fa434' 
  AND (
    token = 'huT/spV7Y7Hetc6Xsh9q3x7imOkNABBMFBlHJiK3r4Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021