UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hqdbkf4BcqibNk24VqyQpDW30iRPimsMUwGYpFMQz2M=' 
WHERE 
  key_id = '7863bdaba017233ee1f7c46cfa47d371389776c8afd4076bd2dd9ad0196b4e78' 
  AND (
    token = 'hqdbkf4BcqibNk24VqyQpDW30iRPimsMUwGYpFMQz2M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029