UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iXiluyIpdrRUxD6Sapj/yJmbQeNNtPEFkU5xLUw1fms=' 
WHERE 
  key_id = 'b796fa7e900897398454cd4a4c91ad26a3a0fb4ea381de88434d538829a95764' 
  AND (
    token = 'iXiluyIpdrRUxD6Sapj/yJmbQeNNtPEFkU5xLUw1fms=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032