UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CUaIr14OTNUaP0OwokKkMWkADF6H6Pu229XpOg7DeOw=' 
WHERE 
  key_id = 'bbf9b2d1822dea76009209db3e13e2bdca066da9a30cca951b0df59da98d9eaa' 
  AND (
    token = 'CUaIr14OTNUaP0OwokKkMWkADF6H6Pu229XpOg7DeOw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034