UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CkrwZpXkks31R2iMyhZ0uqsCGwf9wsdtLvOnDPUvv88=' 
WHERE 
  key_id = '96fd4e468d5809d1b974ed1f8c5ac18c6696efcd55085c6cff22eda3f43faa67' 
  AND (
    token = 'CkrwZpXkks31R2iMyhZ0uqsCGwf9wsdtLvOnDPUvv88=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046