UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UPSzpr4egyqqEudSBoLr2s23gdKGd2ltGAcFQJKt2No=' 
WHERE 
  key_id = '51ad0bfe8c93a6975b6320b62d1992e6d18fbd5fea5ea62476fcc3cf83f82735' 
  AND (
    token = 'UPSzpr4egyqqEudSBoLr2s23gdKGd2ltGAcFQJKt2No=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023