UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cUaUVVDeE5ZTmopGGVuQ6UKjJZLoFSkrpBhjkt5KIDs=' 
WHERE 
  key_id = '3d6a8aff1299bcf816090df52a44c8b37aec306faf3453b16cf20b81da01fc98' 
  AND (
    token = 'cUaUVVDeE5ZTmopGGVuQ6UKjJZLoFSkrpBhjkt5KIDs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019