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

Query time 0.00032