UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gV7u4IyskZSWK6PXcoHiV6a+ikG+lGCim+oz2yV5zrA=' 
WHERE 
  key_id = '8c7b3ef54f4f8b4165de406763cb04a7bca737309fc4075da02f71ffe41520b0' 
  AND (
    token = 'gV7u4IyskZSWK6PXcoHiV6a+ikG+lGCim+oz2yV5zrA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025