UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4eQkMc/us7f2lvPipXAhh7HMPzwq/bKx8w5jKPeGZd8=' 
WHERE 
  key_id = '47155cca652c736016fe9fe1cc73796ed18eb4b1a0e9052e871bfa20fe033305' 
  AND (
    token = '4eQkMc/us7f2lvPipXAhh7HMPzwq/bKx8w5jKPeGZd8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039