UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5MRhcZV1sPk4DYOdxVLLcY9CooGgLhf7lnFsKEGIwrQ=' 
WHERE 
  key_id = '7d52a0dd547995cb490f7445f0e84ddaf83ce4650e58e8838aaabcce2562ced7' 
  AND (
    token = '5MRhcZV1sPk4DYOdxVLLcY9CooGgLhf7lnFsKEGIwrQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022